home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
DIGIKT11.ARJ
/
DIGITIZE.DOC
< prev
next >
Wrap
Text File
|
1992-01-26
|
7KB
|
216 lines
DIGIKIT, v1.1
by Andrew Neitzke
DIGIKIT is a library of routines I put together about a year ago
for playback of digitized sounds through a Sound Blaster or
compatible card. Over time, I found that I was going through the
hassle of mailing these routines to people every time someone needed
info on SB programming. Eventually, I decided that I would just put
them all together and release them, so now, here they are.
I can't guarantee that DIGIKIT will work for you. All I can
guarantee is that it works for me. In no event, furthermore, will I
be liable for any damage it may cause you, your computer system, your
psychological health or your cat. Personally, I can't imagine how it
could hurt ANYTHING, but I see these disclaimers everywhere and I
figured I should probably have one.
This library is copyrighted and all rights are reserved except
those expressly granted here. Now, having said that, you may use it
without restriction in your own programs and may distribute it to
anyone you like as far as I'm concerned. However, if you use DIGIKIT
in a program which you release, I would appreciate some sort of
footnote in the docs indicating that you used it.
Should you feel the overpowering urge to support me, you can
send a few bucks (or even just a supportive note) to:
Andrew Neitzke
Oak Hill Court S-220
Narberth, PA 19072-1008
Before using DIGIKIT, you should run DIGITEST.EXE and be sure
that it works properly.
TECHNICAL INFORMATION
---------------------
DIGIKIT operates by loading the Sound Blaster voice driver
CT-VOICE.DRV (as far as I know, this file is included with all Sound
Blaster boards; however, I am uncertain of the legality of
distributing it) and then making calls to it.
** CT-VOICE.DRV IS REQUIRED FOR DIGIKIT TO OPERATE CORRECTLY **
If you want to use these functions and variables in your
program, put DIGITIZE.H in your include directory and place the
statement:
#include "digitize.h"
at the top of all source files which use them. Then link DIGIT?.LIB
(where ? represents your memory model; for example, in the large
memory model, you would use DIGITL.LIB) with your object code, and
call the functions as you would any other. That's all there is to it.
FUNCTIONS
---------
void sbsetup(int irqline, int ioaddr);
This function handles all the setup (including loading) for the Sound
Blaster driver, CT-VOICE.DRV. Its two parameters are the card's IRQ
line (default 7) and I/O port address (default 220h).
void sbdrvload();
This function loads the SB driver (unnecessary if you use sbsetup())
void sbinit(int irqline, int ioaddr);
This function inits the SB driver (unnecessary if you use sbsetup())
Its two parameters are the card's IRQ line (default 7) and I/O port
address (default 220h).
void sbdeinit();
This function "de-initializes" the SB driver and frees its memory.
void sbplay(char far *data, int headerlen);
This function begins play of a sound. The far pointer "data" should
point to a block of sound data in the VOC file format. This data is
required to remain valid until the sound is finished playing, so be
sure not to free the pointer until you can be sure it is done (you
can find out by checking sbstatusword). The integer "headerlen" is
the length of the header to be skipped; for a VOC file it should be
0x1A or 26. For data you have recorded with sbgetvoice(), there is
no header, so headerlen should be set to zero.
Note that no sound will be heard if the speaker is not on.
Control is immediately returned to the calling program.
void sbwaitsound();
This function will pause program execution until the currently
playing/recording sound is finished, or return immediately if no
voice process is active.
void sbtermsound();
This function immediately terminates any sound playing/recording and
returns control to your program.
void sbpausesound();
This function pauses the currently playing sound.
void sbcontsound();
This function continues a previously paused sound.
void sbgetsound(int samprate, int bufsize, char far *buf);
This function begins recording of a sound. The far pointer "buf"
should point to a pre-allocated block of size bufsize. The integer
"samprate" should be the sampling rate in Hertz, from 4000 to 12000.
If the speaker is on during recording, the sound recorded will be
simultaneously output to the speaker.
Control is immediately returned to the calling program.
void sbspeaker(char mode);
This function turns the speaker on or off (1 for ON, 0 for OFF).
sbinit() turns it on by default, but you might want to turn it off
during voice input (see above).
int sbgetversionnumber();
This function returns the version number of the SB driver. The major
version number is held in the MSB, the minor in the LSB.
VARIABLES
---------
char sberrorcond
This variable will be set to one of these values (defined in
digitize.h) when an error occurs in one of the SB functions:
CARDFAILURE SB card failure. May indicate card not present
in system.
IOFAILURE I/O failure. May indicate that the I/O address
is incorrect.
DMAFAILURE DMA failure. May indicate that the IRQ line is
incorrect.
FILEERROR Indicates some sort of file access error,
probably "file not found".
NOTREADY Indicates that a function which requires the
Sound Blaster driver was called without first
initializing it.
NOMEMORY Indicates that there was insufficient memory to
load the driver.
char sbinitialized
Holds 0 if the Sound Blaster driver has not yet been initialized, 1
if it has.
volatile unsigned int sbstatusword
This value is set directly by the SB driver. It holds FFFF while
voice input/output is in progress; otherwise it holds 0000.
DIGIKIT has been tested with Turbo C++ 1.01 on my Gateway 2000 386/25.
Problems? Comments? In addition to the address given above, you can
reach me at:
ILink SoundBoards "ANDREW NEITZKE"
RIME ->???? Common "ANDREW NEITZKE"
Prodigy VTBH81A
Good luck!